package com.yishe.util;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BeanUtils<T> {
	public List<T> list = new ArrayList<T>();
	private Class<T> clazz;
	private SimpleDateFormat fmt;
	private Map<String, Element> fields;

	public static BeanUtils newInstance(Class t){
		return new BeanUtils(t);
	}
	
	private BeanUtils(Class<T> t) {
		clazz = t;
		init(t);
	}

	private void init(Class<T> t) {
		
		fields = new HashMap<String, Element>();
		Field[] temp = t.getFields();
		for (Field field : temp) {
			System.out.println(field.getName());
			System.out.println(field.getName());
		}

	}

	private static class Element {
		private Field field;
		private Method getMethod;
		private Method setMethod;

		public Field getField() {
			return field;
		}

		public void setField(Field field) {
			this.field = field;
		}

		public Method getGetMethod() {
			return getMethod;
		}

		public void setGetMethod(Method getMethod) {
			this.getMethod = getMethod;
		}

		public Method getSetMethod() {
			return setMethod;
		}

		public void setSetMethod(Method setMethod) {
			this.setMethod = setMethod;
		}
	}

	public T convert(Map<String, Object> data) {

		return null;
	}

	public Map<String, Object> convert(T t) {

		return null;
	}

	public List<T> convertFromMap(List<Map<String, Object>> data) {

		return null;
	}

	public List<Map<String, Object>> convertFromEntity(List<T> data) {
		return null;
	}

	public void test() {
		System.out.println(this.clazz.getName());
	}

}
